package org.laizili.solution.nowcodertop101.bitree;

import org.laizili.structure.tree.bitree.TreeNode;

/**
 * <a href="https://www.nowcoder.com/practice/a9d0ecbacef9410ca97463e4a5c83be7?tpId=295&sfm=html&channel=nowcoder">二叉树的镜像</a>
 * <p>
 * tags: 二叉树遍历; 递归
 * </p>
 */
public class BM33 {
    public static class Solution {
        public TreeNode Mirror(TreeNode pRoot) {
            if (pRoot == null)
                return null;
            TreeNode left = Mirror(pRoot.left);
            TreeNode right = Mirror(pRoot.right);
            pRoot.right = left;
            pRoot.left = right;
            return pRoot;
        }
    }
}
